package com.zb.vo;

import com.zb.annotation.NumberPattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

/**
 * @Author WEN
 * @Date 2023/8/23 0023
 **/
@Data
@ApiModel("编码批次对象")
public class CodeBatchVo {

    @NotBlank(message = "批次编码名称不能为空")
    @Length(max = 20, message = "批次编码名称长度限制 20 个字符以内")
    @ApiModelProperty(value = "批次编码名称", required = true)
    private String name;

    @NotNull(message = "编码类型不能为空")
    @NumberPattern(regexp = "^(1|2)$", message = "编码类型不合法！", required = true)
    @ApiModelProperty(value = "编码类型：1-成品、2-备件", required = true)
    private Integer type;

    @NotNull(message = "编码数量不能为空")
    @NumberPattern(regexp = "^[1-9]\\d{0,5}$", message = "编码数量必须为 >0 的正整数，且总编码数量 <=300,000", required = true)
    @ApiModelProperty(value = "编码数量", required = true, example = "1")
    private Integer qty;

    @Valid
    @NotNull(message = "商品数据不能为空")
    @Size(min = 1, message = "商品数据至少要填写一项")
    @ApiModelProperty(value = "商品数据对象", required = true)
    private List<CodeVo> codeVos;
}
